#include <iostream>
#include <vector>
using namespace std;

// 高精度乘法，a 乘以 b，结果存回 a
void multiply(vector<int>& a, int b) {
    int c = 0;
    for (int i = 0; i < a.size(); i++) {
        int p = a[i] * b + c;
        a[i] = p % 10;
        c = p / 10;
    }
    while (c) {
        a.push_back(c % 10);
        c /= 10;
    }
}

// 高精度加法，a 加上 b，结果存回 a
void add(vector<int>& a, vector<int>& b) {
    if (a.size() < b.size()) {
        a.resize(b.size());
    }
    int c = 0;
    for (int i = 0; i < a.size(); i++) {
        int sum = a[i] + (i < b.size()? b[i] : 0) + c;
        a[i] = sum % 10;
        c = sum / 10;
    }
    if (c) {
        a.push_back(c);
    }
}

int main() {
    int n;
    cin >> n;
    vector<int> sum(1, 0);
    vector<int> fc(1, 1);
    for (int i = 1; i <= n; i++) {
        multiply(fc, i);
        add(sum, fc);
    }
    // 从高位到低位输出结果
    for (int i = sum.size() - 1; i >= 0; i--) {
        cout << sum[i];
    }
    cout << endl;
    return 0;
}